home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / kdeprint / kmjobmanager.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-10-10  |  3.4 KB  |  110 lines

  1. /*
  2.  *  This file is part of the KDE libraries
  3.  *  Copyright (c) 2001 Michael Goffioul <kdeprint@swing.be>
  4.  *
  5.  *  This library is free software; you can redistribute it and/or
  6.  *  modify it under the terms of the GNU Library General Public
  7.  *  License version 2 as published by the Free Software Foundation.
  8.  *
  9.  *  This library is distributed in the hope that it will be useful,
  10.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  12.  *  Library General Public License for more details.
  13.  *
  14.  *  You should have received a copy of the GNU Library General Public License
  15.  *  along with this library; see the file COPYING.LIB.  If not, write to
  16.  *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  17.  *  Boston, MA 02110-1301, USA.
  18.  **/
  19.  
  20. #ifndef KMJOBMANAGER_H
  21. #define KMJOBMANAGER_H
  22.  
  23. #if !defined( _KDEPRINT_COMPILE ) && defined( __GNUC__ )
  24. #warning internal header, do not use except if you are a KDEPrint developer
  25. #endif
  26.  
  27. #include <qobject.h>
  28. #include <qptrlist.h>
  29. #include <qdict.h>
  30. #include <qvaluelist.h>
  31.  
  32. #include <kdelibs_export.h>
  33.  
  34. class KMJob;
  35. class KMThreadJob;
  36. class KActionCollection;
  37. class KAction;
  38.  
  39. /**
  40.  * @internal
  41.  * This class is internal to KDEPrint and is not intended to be
  42.  * used outside it. Please do not make use of this header, except
  43.  * if you're a KDEPrint developer. The API might change in the
  44.  * future and binary compatibility might be broken.
  45.  */
  46. class KDEPRINT_EXPORT KMJobManager : public QObject
  47. {
  48.     Q_OBJECT
  49.  
  50. public:
  51.     enum JobType { ActiveJobs = 0, CompletedJobs = 1 };
  52.     struct JobFilter
  53.     {
  54.         JobFilter() { m_type[0] = m_type[1] = 0; m_isspecial = false; }
  55.         int    m_type[2];
  56.         bool m_isspecial;
  57.     };
  58.  
  59.     KMJobManager(QObject *parent = 0, const char *name = 0);
  60.     virtual ~KMJobManager();
  61.  
  62.     static KMJobManager* self();
  63.  
  64.     void addPrinter(const QString& pr, JobType type = ActiveJobs, bool isSpecial = false);
  65.     void removePrinter(const QString& pr, JobType type = ActiveJobs);
  66.     void clearFilter();
  67.     QDict<JobFilter>* filter();
  68.     int limit();
  69.     void setLimit(int val);
  70.  
  71.     //KMJob* findJob(int ID);
  72.     KMJob* findJob(const QString& uri);
  73.     //bool sendCommand(int ID, int action, const QString& arg = QString::null);
  74.     bool sendCommand(const QString& uri, int action, const QString& arg = QString::null);
  75.     bool sendCommand(const QPtrList<KMJob>& jobs, int action, const QString& arg = QString::null);
  76.     const QPtrList<KMJob>& jobList(bool reload = true);
  77.     void addJob(KMJob*);
  78.     KMThreadJob* threadJob();
  79.  
  80.     virtual int actions();
  81.     virtual QValueList<KAction*> createPluginActions(KActionCollection*);
  82.     virtual void validatePluginActions(KActionCollection*, const QPtrList<KMJob>&);
  83.     virtual bool doPluginAction(int, const QPtrList<KMJob>&);
  84.  
  85. protected:
  86.     void discardAllJobs();
  87.     void removeDiscardedJobs();
  88.  
  89. protected:
  90.     virtual bool listJobs(const QString& prname, JobType type, int limit = 0);
  91.     virtual bool sendCommandSystemJob(const QPtrList<KMJob>& jobs, int action, const QString& arg = QString::null);
  92.     bool sendCommandThreadJob(const QPtrList<KMJob>& jobs, int action, const QString& arg = QString::null);
  93.  
  94. protected:
  95.     QPtrList<KMJob>    m_jobs;
  96.     QDict<JobFilter>    m_filter;
  97.     KMThreadJob    *m_threadjob;
  98. };
  99.  
  100. inline QDict<KMJobManager::JobFilter>* KMJobManager::filter()
  101. { return &m_filter; }
  102.  
  103. inline void KMJobManager::clearFilter()
  104. { m_filter.clear(); }
  105.  
  106. inline KMThreadJob* KMJobManager::threadJob()
  107. { return m_threadjob; }
  108.  
  109. #endif
  110.